﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace wisdom_logistics.Migrations
{
    public partial class demo2 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_Trackrecord",
                table: "Trackrecord");

            migrationBuilder.DropPrimaryKey(
                name: "PK_OwnerContract",
                table: "OwnerContract");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Freighttrack",
                table: "Freighttrack");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Circuit",
                table: "Circuit");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Carriagecontract",
                table: "Carriagecontract");

            migrationBuilder.DropColumn(
                name: "TrackId",
                table: "Trackrecord");

            migrationBuilder.DropColumn(
                name: "ContractId",
                table: "OwnerContract");

            migrationBuilder.DropColumn(
                name: "FreighttrackId",
                table: "Freighttrack");

            migrationBuilder.DropColumn(
                name: "CirId",
                table: "Circuit");

            migrationBuilder.DropColumn(
                name: "CarriageId",
                table: "Carriagecontract");

            migrationBuilder.RenameTable(
                name: "Trackrecord",
                newName: "Trackrecords");

            migrationBuilder.RenameTable(
                name: "OwnerContract",
                newName: "OwnerContracts");

            migrationBuilder.RenameTable(
                name: "Freighttrack",
                newName: "Freighttracks");

            migrationBuilder.RenameTable(
                name: "Circuit",
                newName: "Circuits");

            migrationBuilder.RenameTable(
                name: "Carriagecontract",
                newName: "Carriagecontracts");

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "Trackrecords",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "Trackrecords",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "Trackrecords",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "Trackrecords",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "Trackrecords",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "Trackrecords",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "Trackrecords",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "OwnerContracts",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "OwnerContracts",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "OwnerContracts",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "OwnerContracts",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "OwnerContracts",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "OwnerContracts",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "OwnerContracts",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "Freighttracks",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "Freighttracks",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "Freighttracks",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "Freighttracks",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "Freighttracks",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "Freighttracks",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "Freighttracks",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "Circuits",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "Circuits",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "Circuits",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "Circuits",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "Circuits",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "Circuits",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "Circuits",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "Id",
                table: "Carriagecontracts",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ConcurrencyStamp",
                table: "Carriagecontracts",
                type: "varchar(40)",
                maxLength: 40,
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "Carriagecontracts",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<Guid>(
                name: "CreatorId",
                table: "Carriagecontracts",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "ExtraProperties",
                table: "Carriagecontracts",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "LastModificationTime",
                table: "Carriagecontracts",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "LastModifierId",
                table: "Carriagecontracts",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Trackrecords",
                table: "Trackrecords",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_OwnerContracts",
                table: "OwnerContracts",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Freighttracks",
                table: "Freighttracks",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Circuits",
                table: "Circuits",
                column: "Id");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Carriagecontracts",
                table: "Carriagecontracts",
                column: "Id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_Trackrecords",
                table: "Trackrecords");

            migrationBuilder.DropPrimaryKey(
                name: "PK_OwnerContracts",
                table: "OwnerContracts");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Freighttracks",
                table: "Freighttracks");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Circuits",
                table: "Circuits");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Carriagecontracts",
                table: "Carriagecontracts");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "Trackrecords");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "Trackrecords");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "Trackrecords");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "Trackrecords");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "Trackrecords");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "Trackrecords");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "Trackrecords");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "OwnerContracts");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "OwnerContracts");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "OwnerContracts");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "OwnerContracts");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "OwnerContracts");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "OwnerContracts");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "OwnerContracts");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "Freighttracks");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "Freighttracks");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "Freighttracks");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "Freighttracks");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "Freighttracks");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "Freighttracks");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "Freighttracks");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "Circuits");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "Circuits");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "Circuits");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "Circuits");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "Circuits");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "Circuits");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "Circuits");

            migrationBuilder.DropColumn(
                name: "Id",
                table: "Carriagecontracts");

            migrationBuilder.DropColumn(
                name: "ConcurrencyStamp",
                table: "Carriagecontracts");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "Carriagecontracts");

            migrationBuilder.DropColumn(
                name: "CreatorId",
                table: "Carriagecontracts");

            migrationBuilder.DropColumn(
                name: "ExtraProperties",
                table: "Carriagecontracts");

            migrationBuilder.DropColumn(
                name: "LastModificationTime",
                table: "Carriagecontracts");

            migrationBuilder.DropColumn(
                name: "LastModifierId",
                table: "Carriagecontracts");

            migrationBuilder.RenameTable(
                name: "Trackrecords",
                newName: "Trackrecord");

            migrationBuilder.RenameTable(
                name: "OwnerContracts",
                newName: "OwnerContract");

            migrationBuilder.RenameTable(
                name: "Freighttracks",
                newName: "Freighttrack");

            migrationBuilder.RenameTable(
                name: "Circuits",
                newName: "Circuit");

            migrationBuilder.RenameTable(
                name: "Carriagecontracts",
                newName: "Carriagecontract");

            migrationBuilder.AddColumn<int>(
                name: "TrackId",
                table: "Trackrecord",
                type: "int",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<int>(
                name: "ContractId",
                table: "OwnerContract",
                type: "int",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<int>(
                name: "FreighttrackId",
                table: "Freighttrack",
                type: "int",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<int>(
                name: "CirId",
                table: "Circuit",
                type: "int",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddColumn<int>(
                name: "CarriageId",
                table: "Carriagecontract",
                type: "int",
                nullable: false,
                defaultValue: 0)
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AddPrimaryKey(
                name: "PK_Trackrecord",
                table: "Trackrecord",
                column: "TrackId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_OwnerContract",
                table: "OwnerContract",
                column: "ContractId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Freighttrack",
                table: "Freighttrack",
                column: "FreighttrackId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Circuit",
                table: "Circuit",
                column: "CirId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Carriagecontract",
                table: "Carriagecontract",
                column: "CarriageId");
        }
    }
}
